package org.grey.edz.payload;

import java.util.HashMap;
import java.util.Map;
import java.util.function.Supplier;

/**
 * @program: easy-data-zipper
 * @ClassName EDZPayload
 * @description: 处理器负载
 * @author: Grey
 * @create: 2024-02-19 15:46
 */
public class EDZPayload {

    //源对象
    private Object source;

    //目标对象
    private Object target;

    private Class<?> clazz;

    /*待转换的属性名集合*/
    private String[] properties;

    /*值的供应商 (保证不会出现空指针) */
    private final Map<String, Supplier<?>> valSupplier = new HashMap<>();

    /*工具属性名集合*/
    private String[] toolProperties;

//    private String


    public Object getSource() {
        return source;
    }

    public EDZPayload setSource(Object source) {
        this.source = source;
        return this;
    }

    public Object getTarget() {
        return target;
    }

    public EDZPayload setTarget(Object target) {
        this.target = target;
        return this;
    }

    public String[] getProperties() {
        return properties;
    }

    public EDZPayload setProperties(String[] properties) {
        this.properties = properties;
        return this;
    }

    public String[] getToolProperties() {
        return toolProperties;
    }

    public EDZPayload setToolProperties(String[] toolProperties) {
        this.toolProperties = toolProperties;
        return this;
    }

    public Class<?> getClazz() {
        return clazz;
    }

    public EDZPayload setClazz(Class<?> clazz) {
        this.clazz = clazz;
        return this;
    }

    public Map<String, Supplier<?>> getValSupplier() {
        return valSupplier;
    }

    public EDZPayload ValSupplierPutter(String key , Supplier<?> supplier){
        this.valSupplier.put(key,supplier);
        return this;
    }
}
